DEF FN function definitions are not permitted inside control constructs such as IF...THEN...ELSE and SELECT CASE.